package com.jt.demo1.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class JdkProxy1 {
    public static Object getjdk(Object target){
        ClassLoader lo = target.getClass().getClassLoader();
        Class<?>[] interfaces = target.getClass().getInterfaces();
        InvocationHandler handler = new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                long l = System.currentTimeMillis();
                Object invoke = method.invoke(target, args);
                long l1 = System.currentTimeMillis();
                return null;
            }
        };
        return Proxy.newProxyInstance(lo,interfaces,handler);
    }
}
